import 'package:flutter/material.dart';
import 'package:flutter_shop/pages/base/base_state_less_widget.dart';
import 'package:flutter_shop/pages/member/member_tab_page/member_tab_presenter.dart';
import 'package:flutter_shop/r.dart';
import 'package:flutter_shop/res/styles.dart';
import 'package:flutter_shop/utils/utils.dart';
import 'package:flutter_shop/widget/single_line_item.dart';
import 'package:flutter_shop/widget/water_click.dart';

/// Title:我的订单 <br/>
/// Description: <br/>
/// author:Administrator <br/>
/// date: 2020-03-11  <br/>
/// version 1.0 <br/>
class MyOrder extends BaseStateLessWidget<MemberTabPresenter> {
  final List<Map<String, String>> myOrders = [
    {"image": R.assetsImgMemberIconWaitPay, "title": "待付款"},
    {"image": R.assetsImgMemberIconWaitSend, "title": "待发货"},
    {"image": R.assetsImgMemberIconWaitSign, "title": "待收货"},
    {"image": R.assetsImgMemberIconWaitComment, "title": "待评价"},
  ];

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          SingleLineItem(
            leftImage: R.assetsImgMemberIconOrder,
            leftText: "我的订单",
            onPressed: () {
              Utils.showToast("我的订单");
            },
          ),
          GridView.builder(
            padding: EdgeInsets.all(0.0),
            itemCount: myOrders.length,
            physics: NeverScrollableScrollPhysics(),
            shrinkWrap: true,
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
              crossAxisCount: 4,
            ),
            itemBuilder: (context, index) {
              Map<String, String> item = myOrders[index];
              return WaterClick(
                fillColor: Colors.white,
                onPressed: () {
                  Utils.showToast(item['title']);
                },
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Image.asset(
                      item['image'],
                      width: 30,
                      height: 30,
                    ),
                    Gaps.v_gap_5,
                    Text(
                      item['title'],
                      style: TextStyles.second_text,
                    ),
                  ],
                ),
              );
            },
          )
        ],
      ),
    );
  }
}
